home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-19 / elflib.zip / TEMPLATE.LSP < prev    next >
Text File  |  1992-12-01  |  3KB  |  97 lines

  1. ;;; TEMPLATE.LSP - Generic ELF application template
  2. ;;; Copyright 1992 by Mountain Software
  3. ;;;
  4. ;;; This program requires ELF, the Extended List Function library
  5. ;;;
  6. ;;; Template.Lsp creates a screen header and footer, fills the screen,
  7. ;;; defines a help screen, and then executes a menu. Change the menu
  8. ;;; labels and function names to your own function names and include
  9. ;;; those functions in this file (rename the file and functions if you wish).
  10.  
  11. (Princ "\nLoading Template.Lsp")
  12. (Load"ELF")                             ;load ELF.EXP, color and key symbols
  13.  
  14. ;;;*----- The Main Function
  15.  
  16. (DeFun C:TEMPLATE( / menu_strmenu_fun  help_screen mitems i key bcolor
  17.              done video vcols vrows)
  18.   (TextScr)
  19.   (SetQ menu_str    '("Function 1" "Function 2" "Function 3")
  20.     menu_fun    '(FUNCTION1 FUNCTION2 FUNCTION3)
  21.     mitems        (length menu_str)
  22.     old_error    *error*
  23.         *error*         MyError
  24.     bcolor        (| white lgrey_bg)
  25.     attr        (| lgrey blue_bg)
  26.     col        (| black lgrey_bg)
  27.     done        nil
  28.     video        (Get_Video)
  29.     vcols        (Car video)
  30.     vrows        (Cadr video))
  31.   (Set_Color attr)
  32.   (Set_Menu_Help '("Help Title" "User Defined" "Help Message"))
  33.   (Scr_Fill 0 3 vcols (- vrows 2) 176 bcolor)
  34.  
  35.   ;;;*----- Top title bar
  36.  
  37.   (Wopen 0 0 vcols 3 col col (| single_bd tlhl_bd))
  38.   (WputCen "ELF Program Template")
  39.  
  40.   ;;;*----- Create a status line on the bottom row
  41.  
  42.   (Scr_Fill 0 (1- vrows) vcols 1 32 (| black lgrey_bg))
  43.   (Prts 2 (1- vrows) "[F1] - Help  [Esc] - Quit")
  44.  
  45.   ;;;*----- Loop until done
  46.  
  47.   (While (Not done) (Progn
  48.     (Wopen -1 -1 20 (+ mitems 6) (| white cyan_bg) (| lcyan cyan_bg) (| no_bd shadow_bd))
  49.     (Wtitle "Template Menu" 1 (| black cyan_bg))
  50.     (Wtitle "Select" 4 (| yellow cyan_bg))
  51.     (SetQ ans (Wmenu menu_str -1 -1 (| white cyan_bg) (| black cyan_bg)
  52.              (| white black_bg) (| single_bd tlhl_bd))
  53.           key (Cadr ans)
  54.       i   (Car ans))
  55.     (Wclose)
  56.     (Wpopup Vcols Vrows 7 7 0)
  57.     (If(= key Esc_Key)
  58.       (SetQ done T)
  59.     ;else
  60.       (Eval (List(nth i menu_fun)))    ;Execute the selected function
  61.     )
  62.     (Wclose)
  63.   ))
  64.   (Wclose)
  65.   (Cls 7)
  66.   (SetQ *error* old_error old_error nil)
  67.   (Princ)
  68. )
  69.  
  70. (DeFun FUNCTION1()
  71.   (Wmsg "Function 1 Selected")
  72. )
  73.  
  74. (DeFun FUNCTION2()
  75.   (Wmsg "Function 2 Selected")
  76. )
  77.  
  78. (DeFun FUNCTION3()
  79.   (Wmsg "Function 3 Selected")
  80. )
  81.  
  82. ;;;*----- Our Error Routine
  83.  
  84. (DeFun MyError(s)
  85.   (beep)
  86.   (Wmsg (strcat "Template ERROR\n" s) 1 (| white red_bg))
  87.   (WcloseAll)
  88.   (Cls 7)
  89.   (SetQ *error* old_error old_error nil)
  90.   (princ)
  91. )
  92.  
  93. (Princ "\nTemplate.Lsp loaded, Enter \"TEMPLATE\" to run...")
  94. (Princ)
  95.  
  96. ;;;*----- End of Template.Lsp
  97.